Allow defining an invisible resize area for GtkPaned's handle.
authorVictor Martinez <victor@elementaryos.org>
Sat, 12 Apr 2014 02:50:48 +0000 (20:50 -0600)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 22 Apr 2014 23:38:26 +0000 (19:38 -0400)
This should allow theme developers to use a very small width for
the resize handle, but still let users easily move the handle by
defining a wider resize area.

The additional resize area follows the "margin" style property.

https://bugzilla.gnome.org/show_bug.cgi?id=728073

gtk/gtkpaned.c

index 2fe515a5bd66a1824b993efa820a9249c76d2c84..6a0b6e5bc188d2df8b7bd9eaccf957553c3799a1 100644 (file)
@@ -1277,24 +1277,30 @@ gtk_paned_size_allocate (GtkWidget     *widget,
 
       if (gtk_widget_get_realized (widget))
        {
+          GtkBorder margin;
+
+          gtk_style_context_get_margin (gtk_widget_get_style_context (widget),
+                                        gtk_widget_get_state_flags (widget),
+                                        &margin);
+
          if (gtk_widget_get_mapped (widget))
            gdk_window_show (priv->handle);
 
           if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
             {
               gdk_window_move_resize (priv->handle,
-                                      priv->handle_pos.x,
+                                      priv->handle_pos.x - margin.left,
                                       priv->handle_pos.y,
-                                      handle_size,
+                                      handle_size + margin.left + margin.right,
                                       priv->handle_pos.height);
             }
           else
             {
               gdk_window_move_resize (priv->handle,
                                       priv->handle_pos.x,
-                                      priv->handle_pos.y,
+                                      priv->handle_pos.y - margin.top,
                                       priv->handle_pos.width,
-                                      handle_size);
+                                      handle_size + margin.top + margin.bottom);
             }
        }
 
@@ -2842,4 +2848,4 @@ gtk_paned_get_handle_window (GtkPaned *paned)
   g_return_val_if_fail (GTK_IS_PANED (paned), NULL);
 
   return paned->priv->handle;
-}
+}
\ No newline at end of file